package ltd.hxya.novel.user.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import ltd.hxya.novel.common.bean.BaseEntity;
import ltd.hxya.novel.common.valid.SaveOperate;
import ltd.hxya.novel.common.valid.UpdateOperate;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;

/**
 * <p>
 *
 * </p>
 *
 * @author hxya
 * @since 2022-09-13
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("user")
@ApiModel(value="User对象", description="")
public class User extends BaseEntity implements Serializable{

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @NotNull(groups = UpdateOperate.class,message = "id不能为空")
    @Null(groups= SaveOperate.class,message = "id必须为空")
    @TableId(value = "id", type = IdType.AUTO)
    private String id;

    @ApiModelProperty(value = "登录名")
    @Size(min = 11,max = 11,message = "登录名必须11位",groups = {SaveOperate.class,SaveOperate.class})

    private String username;

    @ApiModelProperty(value = "登录密码")
    @Size(min = 6,max = 12,message = "登录密码在6位到12位之间",groups = {SaveOperate.class})
    private String password;

    @ApiModelProperty(value = "昵称")
    @Size(min = 5,max = 10,message = "昵称必须在5位到10位之间",groups = {UpdateOperate.class,SaveOperate.class})
    private String nickName;

    @ApiModelProperty(value = "用户头像")
    private String userPhoto;

    @ApiModelProperty(value = "用户性别，0：男，1：女")
    private Integer userSex;

    @ApiModelProperty(value = "账户余额")
    @Null
    private float accountBalance;

    @ApiModelProperty(value = "个人介绍，个性签名")
    private String sign;

    @ApiModelProperty(value = "用户状态，0：正常")
    private Boolean status;





}
